package com.xinxin.leetcode.problem575;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * @author ShiXinXin
 * @date 2020-02-07 12:44
 */
public class Solution {
    public int distributeCandies(int[] candies) {
        Set<Integer> set = new HashSet<>(10000);
        for (int candy : candies) {
            set.add(candy);
        }
        return Math.min(set.size(), candies.length / 2);
    }

    public static void main(String[] args) {
        System.out.println(new Solution().distributeCandies(new int[]{1, 1, 2, 3}));
    }
}
